package cate.game.role.res.channelgift.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBChannelGift;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "渠道礼包领取 请求")
public class ChannelGiftReceiveReq implements MsgInput {
    @NoteField("配置ID")
    public int tid;

    @Override
    public MsgConfig conf() {
        return MsgIdBChannelGift.CHANNEL_GIFT_RECEIVE_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = cc.getRole().getRes().channelGift.receiveGift(tid);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }
}
